// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

Vue.config.productionTip = false

import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
import './assets/style/weui.css';
Vue.use(MintUI)
import 'amfe-flexible'
import url from './url/index.js'
Vue.prototype.$url = url
import api from './axios/index';
Vue.prototype.$api = api;
import './assets/js/data'
import 'font-awesome/css/font-awesome.min.css'
import store from './store/index.js'
import ElementUI from 'element-ui';
import './theme/elementUI/index.css';
Vue.use(ElementUI);
router.beforeEach((to,from,next)=>{
  if(to.meta.requireAuth){
    if(store.state.user){
      next()
    }else{
      next({path:'/login'})
    }
  }else{
    next()
  }
})
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
